package SV_WEAK_TLS;
import javax.net.ssl.*;
import java.io.IOException;

public class Vulnerable_03 {
    public class Test {
        public void test() throws IOException {
            SSLServerSocket serverSocket = null;
            try {
                SSLServerSocketFactory factory = (SSLServerSocketFactory) SSLServerSocketFactory.getDefault();
                serverSocket = (SSLServerSocket) factory.createServerSocket(8980);
                SSLParameters params = new SSLParameters();
                params.setProtocols(new String[] {"TLSv1.1"});
                serverSocket.setSSLParameters(params);
                SSLSocket sslSocket = (SSLSocket) serverSocket.accept();
            } catch (Exception e) {
                e.printStackTrace();
            } finally {
                if (serverSocket != null) {
                    serverSocket.close();
                }
            }
        }
    }
}
